/**
 * @file memory_heap1.c
 * @author Linquan  
 * @brief  可以分配，但分配的空间无法操作,报段错误
 * @version 1.0
 * @date 2024-06-12
 * 
 * @copyright Copyright (c) 2024
 * 
 */

#include "app_config.h"
#include "../../middle/serve/memory_mange/memory_mang_conf.h"
#if (TEST_MEMORY_TEST_HEAP1&&FREE_RTOS_HEAP_1)

#include <stdio.h>
#include <stdint.h>
#include "../../middle/serve/memory_mange/FreeRTOS_heap1.h"
#include "c_mem.h"
#include "macro_overload.h"



void test()
{
    DEBUG_INFO_PRINT("----TEST memory mange heap1:\n ");
    pt_heap_init();
     uint8_t *ptr;
     uint8_t *item;

    ptr = (uint8_t*)pt_malloc(8);
    *ptr = 1;
    printf("  %x %x\n",(int)ptr,*ptr);
    
    ptr = (uint8_t*)pt_malloc(16);
    c_memset(ptr, 5,4);
    printf("  %x \n",(int)ptr);

    foreach(uint8_t, ptr,item)
    {
        printf("%d \n",*item);
    }


    ptr = (uint8_t*)pt_malloc(8);
    printf("  %x\n",(int)ptr);
}
EXPORT_Lv6_APP_SINGLE(test,NULL);

#endif